#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#

(print (lisp-implementation-type))
(print (lisp-implementation-version))
(print (software-type))
(print (software-version))
(print (machine-instance))
(print (machine-type))
(print (machine-version))
(print (long-site-name))
(ql:register-local-projects)
(ql:quickload :uiop)
(ql:quickload :fiveam)

(defun test (sys tsys)
  (handler-case
      (progn
        (ql:quickload tsys)
        (fiveam:run sys))
    (serious-condition (c)
      (describe c)
      (uiop:quit 2))))

(defun main (&rest argv)
  (declare (ignorable argv))
  (uiop:quit (if (every #'fiveam::TEST-PASSED-P
                        (let ((results
                               (append (test :trivia.level0 :trivia.level0.test)
                                       (test :trivia.level1 :trivia.level1.test)
                                       (test :trivia :trivia.level2.test)
                                       (test :trivia.ppcre :trivia.ppcre.test)
                                       (test :trivia.cffi :trivia.cffi.test)
                                       #+(and asdf3 (not cmu))
                                       (test :trivia.quasiquote :trivia.quasiquote.test))))
                          (5am:explain! results)
                          results))
               0 1)))
